package com.kefu.chat.vo;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.chat.model.ChatMenuConfigPlan;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;
import lombok.Data;

@Data
public class ChatMenuConfigPlanSearchVo extends AbstractSearchVo {
    private String planName;

    @Override
    public LambdaQueryWrapper lambdaQuery() {
        LambdaQueryWrapper<ChatMenuConfigPlan> wrapper = Wrappers.lambdaQuery(ChatMenuConfigPlan.class);
        if (StrUtil.isNotBlank(planName)) {
            wrapper.like(ChatMenuConfigPlan::getPlanName, planName);
        }
        wrapper.eq(ChatMenuConfigPlan::getTenantId, KefuContext.getTid());
        wrapper.orderByDesc(ChatMenuConfigPlan::getUpdateTime);
        return wrapper;
    }
}
